home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 248
/
248.d81
/
t.db+ doc 4
< prev
next >
Wrap
Text File
|
2022-08-26
|
9KB
|
386 lines
u
DOTBASIC PLUS
Part IV
by Dave Moorman & Lee Novak
SCROLL NUMBER ENABLE
--------------------
Include: .SCNUME
.SCNUME,CURRENT,TOTAL,SELECTED
You can add that finishing touch
to a scrolling menu with SCROLL
NUMBER. Like the PRESENTER, you can
make a message like "Line 172 of 308"
that is updated each time the
infomation changes. Multi-select menus
also show the total number of SELECTED
items.
NOTE: CURRENT, TOTAL, and SELECTED
are MEMORY LOCATIONS, presumably on
the screen.
One reason this is a separate
command is because it is RISKY. The
numbers are POKEd to the location you
specify, whether it be the screen or
somewhere it can wreak havoc! So, be
careful when entering these values.
It takes some time to figure out
the screen location to place each
4-digit number at, but it is worth the
effort. Assign 0 to the numbers that
you choose not to enable.
By default, the numbers would
appear in REVERSE text, because bit 7
of MV+15 is set. Note that color RAM
is not affected by number printing.
INDEX SELECTED ITEM
-------------------
Include: .SEL
.SEL,NUMBER
After using a multi-select menu,
.SEL is used to ask for each "N"th
selected item - whenever and as often
as you want - so long as it remains
within the current INDEXable file.
VARIOUS OTHER STUFF
-------------------
Normally, the tip of the mouse
arrow is the pixel to which it point.
But what if you are designing a mouse-
driven shooting game whose pointer
looks like a targeting box?
Related variables: (& defaults)
MV+3 Pointing Pixel-X (0)
MV+4 Pointing Pixel-Y (0)
Use these variables to define the
pointing pixel within your sprite,
where x=0-23 and y=0-20. Expanded
sprites mean you should double the
proper value(s) here, too.
DB+ uses locations $F7-$FE,
$B2-B6, and $9E-$9F for its
non-interrupt routines. Locations 5
and 6 are used to hold temporary
values during the interrupt routines.
MORE COMMANDS
-------------
The above text is adapted from Lee
Novak's Mr.Mouse 2.1 documentation.
The DB+ commands are really links to
Mouse2.1 7K 1000, though they include
self-documentation and some minor
changes. The biggest change is that
Mr.Mouse uses X1,X2,Y1,Y2 to define
areas. DB+ uses X,Y,W,H -- which makes
positioning areas easier (in my humble
opinion).
But DB+ goes further -- much
further -- in offering you commands at
will. Here are the ones that are
currently available (11 12 2007).
FONT-TOOLBOX-STASH
------------------
Include: .FTS
.FTS,PAGE
Using Mr.MICK, you can visually
design a screen, then save it as an
FTS file. This file includes font,
screen, color, and text mode
information. The file fills 16 pages.
Use .BL to bload the FTS file to
memory (anywhere except under I/O --
208-223 -- we suggest page 224), then
use .FTS to put everything on the
screen. Instantly!
100 .BL,"file.fts",d,224*256
110 .FTS,224
TEXT
----
Include: .TEXT
.TEXT,X,Y,W,STRING
Prints STRING at X,Y, word wrapped
at width W. Add 128 to Y to center the
block vertically on row Y.
TEXTC
-----
Include: .TEXTC
.TEXTC,Y,W,STRING
Prints STRING centered, beginning
on row Y, word wrapped at width W. Add
128 to Y to center vertically on row
Y.
SAVE STRING IN MEMORY
---------------------
Include: .SAVSTR,.SETSTR
.SETSTR,LOCATION
.SAVSTR,STRING
These two commands allow you to
put BASIC strings into memory, (under
ROM, but not under I/O), then rack the
data with .RK and index the strings
with .RI,Index.
.SETSTR sets the beginning of
string memory. Then .SAVSTR,STRING
copies the STRING to that memory,
followed by a zero byte. The next
.SAVSTR,STRING begins at that zero
byte. After .SAVSTR,STRING, the
variable FP holds the memory location
of the zero byte. Thus, you can use
these commands to create a text file!
Assuming you have strings in A$(n)
array:
100 .SETSTR,49152
110 FOR X = 1 TO 10
120 .SAVSTR,A$(X)
130 NEXT
140 .BS,"T.TEXT",D,49152,FP+1
Now you can load those strings
into another array with:
200 .BL0,"T.TEXT",D,160*256
210 .RK,160*256
220 DIM B$(N%)
230 FOR X=1TON%
240 .RI,X
250 B$(X)=W$
260 NEXT
Another good use is to "collect"
filenames with a certain extension:
300 .DIR,"$:*",D,160*256,240
310 .RK,160*256
320 .SETSTR,160*256
330 F=0:FOR X=1TON%
340 .RI,X:IF RIGHT$(F$,4)=".DBS"
THEN:.SAVSTR,F$:F=1
350 NEXT
360 IF F<>1 THEN END
370 .RK,160*256
380 FOR X=1TON%:.RI,X:PRINTW$:NEXT
And yes! You can collect right on
top of the directory data, because
your string list will be smaller than
the directory on every line.
SPRITE CONTROL
--------------
Include: .SPRITE,.SPRFX,.SPRMV
.SPRITE,S#,0/1,I#,COLOR,X,Y
.SPRFX,S#,XEX,YEX,PRI,MC
.SPRMV,S#,X,Y,MODE
The .SPRITE command puts any
sprite anywhere on the screen. S# is
the Sprite Number (0-7). 0/1 is Off
(0) or On (1). I# is the Image Number.
(In DB+, Sprite Images can run from
185 to 223.) COLOR is obvious, as are
X and Y. Remember, visible Sprite
coordinates begin with X=24 and Y=50.
You can bypass settings you do not
want to change. If I#=0 then the Image
will not be changed. COLOR=16 ignores
the color. And if X=0, the sprite
will not be moved.
.SPRFX controls the various
switches: XEX and YEX are X-Expand and
Y-Expand. PRI is sprite Priority, and
MC is Multi-Color. Putting 128 in any
of these we leave the setting
unchanged.
.SPRMV allows you to link the
positions of sprites to each other
with given offsets. Sprite 0 cannot be
linked, but each of the other sprites
can be linked to the sprite just
before it.
For example, you have a moveable
object that requires two sprites
staying side by side. We will use
sprites 0 and 1:
100 .SPRMV,1,24,0,1
110 .SPRMV,0,100,100,0
In line 100, we set MODE to 1 to
link Sprite 1 to Sprite 0. The X/Y
values are the pixel offsets -- +24
and 0. The offsets can be negative
numbers!
Then, in line 110, we use MODE 0
to position Sprite 0 at 100/100.
Sprite 1 will be placed at 124/100.
The offsets continue until a
non-linked sprite occurs (or Sprite
7). To unlink a sprite, use MODE 128.
SPRITES IN VARIABLES
--------------------
Include: .ISPR,.SSPR,.XSPR
.ISPR,VAR$,LOC
.SSPR,S#,VAR$
.XSPR,S#,LOC,INDEX
Here is a completely different
method for handling sprites in your
program. You can bload a slew of
sprite images then put them in string
variables with .ISPR. When you need a
particular image, use .SSPR to move
the image in the string variable to
the sprite.
Or, load a file of sprites into
memory (even under ROM), and use .XSPR
to choose which image to put in each
sprite.
Here is an example of using .ISPR
and .SSPR to handle sprites:
99 REM POSITION SPRITE 5
100 .SPRITE,5,1,185,2,100,100
109 REM BLOAD SPRITES
110 .BL,"SPRITES.SPR",D,49152
119 REM PUT SPRITES IN AN ARRAY
120 FORX=0TO9:.ISPR,W$,49152+X*64
122 A$(X)=W$:NEXT
129 REM PUT IMAGES IN SPRITE 5
130 FORX=0TO9
132 .SSPR,5,A$(X)
134 .DO:.MA:.UN L2%
136 NEXT
With .ISPR and .SSPR, the sprite
images must be in open memory.
However, .XSPR lets you put your
sprite file ANYWHERE in memory, then
call the sprite images with an index
number.
100 REM SPRITE 5 HAS BEEN DEFINED
109 REM BLOAD FILE UNDER ROM
110 .BL,"SPRITES.SPR",D,40960
119 REM AND DO IT!
120 FORX=0TO9
122 .XSPR,5,40960,X
124 .DO:.MA:.UNL2%
126 NEXT
Can we handle a zillion sprite
images?
INTEGER TO FLOATING POINT
-------------------------
Include: .I2FP
.I2FP,INTEGER
Result in FP
Tired of having to convert
Integers just because they have a
value greater than 32767? Just put the
integer in this command. The unsigned
value is returned in the variable FP.
.I2FP,FRE(0)
WAITKEY
-------
Include: .WKEY
.WKEY
Halts the program until a key is
pressed. The ASCII value is returned
in I%.
KEY/MOUSE WAIT
--------------
Include: .KEYMW
.KEYMW
And if you think .WKEY is cool,
.KEYMW halts the program until a key
is pressed OR a mouse button is
clicked. For mouse clicks, I% is -1
for a left click and -2